const { BaiduFanyiAPI } = require('baidu-fanyi-api');

const api = new BaiduFanyiAPI();

function translate(str) {
    return new Promise(async(resolve, reject) => {
        await api.init();
        resolve(api.translate(str, 'zh', 'en'));
    })
}


module.exports = {
    translate
}